// export let weaterMaskCanvasFn = (params = {}) => {
//   let len = params.len || params.text.length || 3 // 可通过此数值大小，控制相邻文字的间距。
//   const canvas = document.createElement('canvas')
//   let fontSize = params.fontSize || 14,
//     height = 180
//   canvas.width = len * fontSize * 2.2 // 可根据实际效果，修改2.2值
//   canvas.height = height + fontSize * 1.8
//   const context = canvas.getContext('2d')
//   context.translate(0, canvas.height / 1.8)
//   context.rotate(((params.rotate || -30) * Math.PI) / height)
//   context.font = `${fontSize}px Vedana`
//   context.fillStyle = params.color || '#f0f'
//   context.fillText(params.text, 10, canvas.height / 2 - 100)
//   const div = document.createElement('div')
//   div.style.pointerEvents = 'none'
//   div.style.position = 'absolute'
//   div.style.zIndex = '999999'
//   div.style.left = 0
//   div.style.top = 0
//   div.style.opacity = params.opacity || 0.5
//   div.style.width = '100%'
//   div.style.height = '100%'
//   div.style.background = `url(${canvas.toDataURL('images/png')}) repeat left top`
//   console.log(params.dom, 'params.dom')
//   params.dom.appendChild(div)
// }
export let weaterMaskCanvasFn = (params = {}) => {
  let len = params.len || Math.max(params.name.length, params.phone.length) || 3 // 可通过此数值大小，控制相邻文字的间距。
  const canvas = document.createElement('canvas')
  let fontSize = params.fontSize || 14,
    height = 180
  canvas.width = len * fontSize * 2.2 // 可根据实际效果，修改2.2值
  canvas.height = height + fontSize * 1.8
  const context = canvas.getContext('2d')
  context.translate(0, canvas.height / 1.8)
  context.rotate(((params.rotate || -30) * Math.PI) / height)
  context.font = `${fontSize}px Vedana`
  context.fillStyle = params.color || '#f0f'
  context.fillText(params.name, 10, canvas.height / 2 - 100)
  context.fillText(params.phone, 10, canvas.height / 2 - 100 + fontSize + 5) // 增加行间距
  const div = document.createElement('div')
  div.style.pointerEvents = 'none'
  div.style.position = 'absolute'
  div.style.zIndex = '999999'
  div.style.left = 0
  div.style.top = 0
  div.style.opacity = params.opacity || 0.5
  div.style.width = '100%'
  div.style.height = '100%'
  div.style.background = `url(${canvas.toDataURL('images/png')}) repeat left top`
  console.log(params.dom, 'params.dom')
  params.dom.appendChild(div)
}
